<?php
/**
 * A database driver for the PostgreSQL database.
 */
class Database_Driver_Postgresql extends Database_Driver_Abstract implements Database_Driver {
    /**
    * The database hostname.
    * @var string
    */
    protected $hostname = '';
    /**
    * The username for the database.
    * @var string
    */
    protected $username = '';
    /**
    * The password for the database.
    * @var string
    */
    protected $password = '';
    /**
    * The database name.
    * @var string
    */
    protected $dbname = '';

    /**
    * Set up this object from a Config_Section object.
    * @param Config_Section $config
    */
    public function __construct(Config_Section $config) {
        $this->drivername = $config->driver;
        $this->hostname = $config->hostname;
        $this->username = $config->username;
        $this->password = $config->password;
        $this->dbname = $config->database;
    }

    /**
    * Get the driver's name.
    * @return string
    */
    public function getDriverName() {
        return $this->drivername;
    }

    /**
    * Connect to the database.
    */
    public function connect() {
    }

    /**
     * Take and store a query for later.
     * 
     * @param string $sql
     * @throws Database_Exception
     */
    public function prepare($sql) {
        if(!is_string($sql) || empty($sql)) {
            throw new Database_Exception('Query is empty or not a string.');
        }
        $this->query = $sql;
    }
    
    /**
     * Execute an SQL query.
     */
    public function execute() {
    }

    /**
    * Run a query.
    * @todo Finish this method.
    */
    public function query() {
        $this->execute('');
    }

    public function beginTransaction() {
    }

    public function commit() {
    }

    public function rollback() {
    }
}
?>